// 自定义事件的

let MyEvent = {
    event: {
        'helloSuccess': [] //事件队列
    },
    on: function(eventName,eventFn) {
        // 添加事件队列
        if (this.event[eventName]) {
            this.event[eventName].push(eventFn)
        } else {
            this.event[eventName] = []
            this.event[eventName].push(eventFn) 
        }
    },
    emit: function (eventName,masageDate) {
        if (this.event[eventName]) {
            this.event[eventName].forEach(elementEvent => {
                elementEvent(masageDate)
            });
        }
    }
}

module.exports = MyEvent